home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / util2 / vol12n11.zip / OLFONT.ZIP / OLFLINE.C < prev    next >
C/C++ Source or Header  |  1993-04-01  |  1KB  |  52 lines

  1. /*-----------------------------------------
  2.    OLFLINE.C -- Outlined OS/2 Outline Font
  3.                 (c) Charles Petzold, 1993
  4.   -----------------------------------------*/
  5.  
  6. #define INCL_WIN
  7. #define INCL_GPI
  8. #include <os2.h>
  9. #include <string.h>
  10. #include "olf.h"
  11.  
  12. #define LCID_FONT    1
  13.  
  14. void PaintClient (HPS hps, SHORT cxClient, SHORT cyClient)
  15.      {
  16.      static CHAR szText [] = "Hello!" ;
  17.      POINTL      ptl, aptlTextBox [TXTBOX_COUNT] ;
  18.  
  19.           // Create and size the logical font
  20.  
  21.      CreateOutlineFont (hps, LCID_FONT, "Times New Roman Italic", 0, 0) ;
  22.      GpiSetCharSet (hps, LCID_FONT) ;
  23.      ScaleOutlineFont (hps, 1440, 1440) ;
  24.  
  25.           // Get the text box
  26.  
  27.      GpiQueryTextBox (hps, strlen (szText), szText,
  28.                       TXTBOX_COUNT, aptlTextBox) ;
  29.  
  30.           // Create the path
  31.  
  32.      GpiBeginPath (hps, 1) ;
  33.  
  34.      ptl.x = (cxClient - aptlTextBox [TXTBOX_CONCAT].x) / 2 ;
  35.      ptl.y = (cyClient - aptlTextBox [TXTBOX_TOPLEFT].y
  36.                        - aptlTextBox [TXTBOX_BOTTOMLEFT].y) / 2 ;
  37.  
  38.      GpiCharStringAt (hps, &ptl, strlen (szText), szText) ;
  39.  
  40.      GpiEndPath (hps) ;
  41.  
  42.           // Outline the path
  43.  
  44.      GpiSetLineWidth (hps, LINEWIDTH_THICK) ;
  45.      GpiOutlinePath (hps, 1, 0) ;
  46.  
  47.           // Select the default font; delete the logical font
  48.  
  49.      GpiSetCharSet (hps, LCID_DEFAULT) ;
  50.      GpiDeleteSetId (hps, LCID_FONT) ;
  51.      }
  52.